<?php

namespace app\admin\model\exam;

use addons\exam\enum\CateUses;
use addons\exam\model\BaseModel;
use think\Config;
use think\Db;
use traits\model\SoftDelete;

/**
 * 主系统试题表模型
 */

class MainQuestionModel extends BaseModel
{
    use SoftDelete;

    protected $connection = 'db2';
    // 表名
    protected $name = 'exam_question';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;

    // 定义时间戳字段名
    protected $createTime = false;
    protected $updateTime = false;
    protected $deleteTime = false;

    /**
     * 查询第四级题库下对应的试题
     */
    public static function getQuestionByCateId($cate_id)
    {
        return self::initReturnToArray(self::where(['cate_id'=>$cate_id])->select());
    }

    public function getKindAttr($val)
    {
        return __($val);
    }

    public function getDifficultyAttr($val)
    {
        return __($val);
    }

}
